<?php
/**************************************************************************
 * Naanal PHP Framework, Simple, Efficient and Developer Friendly
 * Copyright (C) <2010>  <Tamil Amuthan. R>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ************************************************************************/

class ClsWSettings extends  ClsWrapper
{
	function __construct($module=false)
	{
            parent::__construct($module);
	}
	/**
	 * 
	 * get the values for filling the dropdown
	 * @param $name
	 */
	function get_lookup($name)
	{
		$sql="select usersetting_dropdown.`id`,usersetting_dropdown.`name`,usersetting_dropdown.`name` from usersetting,usersetting_dropdown where usersetting.id=usersetting_dropdown.usersetting_id and usersetting.`name`='{$name}'";
		$this->pdo->setQuery($sql);
		$arrAssoc=$this->pdo->getAllAssoc();
		$arrData=array();
		if($arrAssoc)
		foreach($arrAssoc as $row)
		{
			$arrData[$row["id"]]=$row["name"];
		}
		return $arrData;
	}
	/**
	 * returns the value
	 * @param $name
	 */
	function get_data($name)
	{
		$sql="select * from `usersetting` where `name`='{$name}'";
		$this->pdo->setQuery($sql);
		$arrAssoc=$this->pdo->getAllAssoc();
		if(isset($arrAssoc[0]["data"]))
		{
			return $arrAssoc[0]["data"];
		}
		return false;
	}
	function get_adjustmentgrid_lookup()
	{
		$obj=new ClsWAdjustmentgrid();
		$arrWhere=array();
		$objUser=getUserObject();
		$client_id=$objUser->get_client_id();
		//$arrWhere[]=array("field"=>"client_id","data"=>$client_id);
		return $obj->getColumn("adjustmentgridname");
	}
}
?>